import 'package:flutter/material.dart';

class DrawerDemo extends StatefulWidget {
  DrawerDemo({Key key}) : super(key: key);
  @override
  _DrawerDemoState createState() => _DrawerDemoState();
}

class _DrawerDemoState extends State<DrawerDemo> {
  @override
  Widget build(BuildContext context) {
    return Drawer(
      child: Column(
        children: [
          Row(
            children: [
              Expanded(
                  child: UserAccountsDrawerHeader(
                accountEmail: Text('865509949@qq.com'),
                accountName: Text('kuangw'),
                currentAccountPicture: CircleAvatar(
                  backgroundImage: NetworkImage(
                      'https://pic1.zhimg.com/v2-f4f6a754cf688364926a90353418f620_r.jpg'),
                ),
                decoration: BoxDecoration(
                    image: DecorationImage(
                        image: NetworkImage(
                            'https://pic3.zhimg.com/v2-94c356738e645c845c20f9a08946448e_r.jpg'),
                        fit: BoxFit.cover)),
              ))
            ],
          ),
          ListTile(
            title: Text('去按钮页面'),
            leading: CircleAvatar(
              child: Icon(Icons.home),
            ),
            onTap: () {
              Navigator.pop(context);
              Navigator.pushNamed(context, '/profile');
            },
          ),
          ListTile(
            title: Text('个人中心'),
            leading: CircleAvatar(
              child: Icon(Icons.people),
            ),
            onTap: () {
              Navigator.pop(context);
              Navigator.pushNamed(context, '/profile');
            },
          ),
          RaisedButton(
            onPressed: () {},
            child: Text('我是一个按钮'),
            elevation: 10, // 配置阴影
          ),
          IconButton(icon: Icon(Icons.ac_unit), onPressed: () {})
        ],
      ),
    );
  }
}
